﻿Option Strict On
Option Explicit On
Option Infer On

Imports System

<Flags()> _
Public Enum TypeModifiers
   ' These values must be explicitly set because this is a flagged (bitwise) enumeration
   None = 0
   [MustInherit] = 1
   [NotInheritable] = 2
   [Partial] = 4
End Enum

Namespace VB
   Public Module TypeModifiersExtensions
      <System.Runtime.CompilerServices.Extension()> _
      Public Function Output(ByVal modifiers As TypeModifiers) As String
         Dim ret As String = String.Empty
         If (modifiers And TemplateSupport.TypeModifiers.MustInherit) = TemplateSupport.TypeModifiers.MustInherit Then
            ret &= "MustInherit "
         End If
         If (modifiers And TemplateSupport.TypeModifiers.NotInheritable) = TemplateSupport.TypeModifiers.NotInheritable Then
            ret &= "NotInheritable "
         End If
         If (modifiers And TemplateSupport.TypeModifiers.Partial) = TemplateSupport.TypeModifiers.Partial Then
            ret &= "Partial "
         End If
         Return ret
      End Function
   End Module
End Namespace

Namespace CSharp
   Public Module TypeModifiersExtensions
      <System.Runtime.CompilerServices.Extension()> _
      Public Function Output(ByVal modifiers As TypeModifiers) As String
         Dim ret As String = String.Empty
         If (modifiers And TemplateSupport.TypeModifiers.MustInherit) = TemplateSupport.TypeModifiers.MustInherit Then
            ret &= "abstract "
         End If
         If (modifiers And TemplateSupport.TypeModifiers.NotInheritable) = TemplateSupport.TypeModifiers.NotInheritable Then
            ret &= "sealed "
         End If
         If (modifiers And TemplateSupport.TypeModifiers.Partial) = TemplateSupport.TypeModifiers.Partial Then
            ret &= "partial "
         End If
         Return ret.Trim
      End Function
   End Module
End Namespace